Skip to content

[CI]: Enforce lazy export synchronization - #174

Merged
Spencer Schoenberg (spencrr) merged 2 commits into
microsoft:mainfrom
spencrr:dev/spencer/lazy-export-lint
Aug 25, 2026
Merged

[CI]: Enforce lazy export synchronization#174
Spencer Schoenberg (spencrr) merged 2 commits into
microsoft:mainfrom
spencrr:dev/spencer/lazy-export-lint

Conversation

@spencrr

@spencrr Spencer Schoenberg (spencrr) commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #173.

Add a repository-specific Flake8 rule that keeps PEP 562 lazy export registries synchronized with the public module API.

  • Add RMP002 to require every __lazy_imports__ key in __all__.
  • Require each declaration to use one direct, statically verifiable literal assignment.
  • Reject redeclarations, additional writes, and direct calls rooted at __all__ or __lazy_imports__; allow pure reads.
  • Split the local plugin into independently registered AsyncSuffixChecker (RMP001) and LazyExportChecker (RMP002).
  • Add focused AST tests for mixed registries, dynamic declarations, incremental construction, reads, and Flake8 wiring.
  • Document the convention and register RMP002 as an external Ruff code.

Validation:

  • python -m pre_commit run --all-files
  • Full unit suite: 732 passed

Breaking changes

None.

Checklist

  • pre-commit run --all-files passes
  • Tests added or updated for changes
  • Documentation updated

@spencrr
Spencer Schoenberg (spencrr) requested a review from a team August 24, 2026 21:48
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@nina-msft Nina Chikanov (nina-msft) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both coverage nits flagged by Copilot - lmk what you think!

Comment thread tools/flake8_rampart.py Outdated
Comment thread tests/unit/tools/test_flake8_rampart.py

@nina-msft Nina Chikanov (nina-msft) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 ✨

@spencrr
Spencer Schoenberg (spencrr) merged commit a2090d8 into microsoft:main Aug 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants